
<html>

	<head>
            <link rel="stylesheet" type="text/css" href="scripts/prueba.css"/>
	</head>

	<body>
		<div class="pcpal">
                <div class="menu">
                <?php
                    require_once("scripts/Menu.php");
                ?>
                </div>
                <div class="content1">
                    <img src="/AppResiduos2/images/6002448.jpg" alt="energia" style="width: 800px; height: 330px;" align="middle">
                </div>
                <div class="content2">

                <?php

                require_once("/var/www/AppResiduos2/lib/dao/EmpresaDAO.php");
                require_once("/var/www/AppResiduos2/lib/dao/ResiduoDAO.php");
                require_once("/var/www/AppResiduos2/lib/dao/ConstituyenteResiduoDAO.php");
                
                $eDAO = new EmpresaDAO();
                $e = $eDAO->listarProductores();
                session_start();
		$privil = $_SESSION['priv'];

                $rDAO = new ResiduoDAO();

                ?>

                    <table id="others" border="1">
				<tr class="alt2">
					<td> Id </td>
					<td> Producer's name </td>
                                        <td> Residues </td>
                                        <td></td>
                                        <td></td>
				</tr>
		<?php
                                        $i = 0;
					while ($i < sizeof($e))
					{
                                            
                ?>				<tr class="alt2">
							<td> <?php print_r($e[$i]->id); ?> </td>
							<td> <?php print_r($e[$i]->name); ?> </td>
                                                        <td>
                                                            <?php
                                                                $res = $rDAO->listarResiduosProductor($e[$i]->id);
                                                                print_r(implode(",", $res));
                                                            ?>
                                                        </td>
		<?php
                                                
						if ($privil == 1)
						{
                                                    
                ?>
							<td> <form method=post action="AdministrarEmpresa.php">
								<input type="hidden" name="name_org" value="<?php print_r($e[$i]->name); ?>">
								<input type="submit" name="modifyOrg" value="Modify"> </form> </td>
							<td> <form method=post action="AdministrarEmpresa.php">
								<input type="hidden" name="name_org" value="<?php print_r($e[$i]->name); ?>">
								<input type="submit" name="deleteOrg" value="Delete"> </form> </td>

		<?php
						}
                                                $i = $i + 1;
		?>

						</tr>
		<?php
					}
					if ($privil == 1){

		?>
						<tr class="alt2">
                                                    <td colspan=3></td>
                                                    <td colspan=1> <form method=post action="AdministrarEmpresa.php"> <input type="submit" name="newOrg" value="New"> </form> </td>
                                                    <td></td>
						</tr>
		<?php
					}
		?>
		</table>
                </div>
		</div>
	</body>



</html>

